import java.util.ArrayList;

import junit.framework.TestCase;

public class ArmAdditionTest extends TestCase {

	private ArrayList<Robot> robots;
	private ArmAddition rWithArm;
	//private ArmAddition rWithArm2;
	private Box box;
	
	public void setUp(){
		robots = new ArrayList<Robot>();
		robots.add(new RV1());
		robots.add(new SmartRobot(new RV1()));
		robots.add(new ArmAddition(new SmartRobot(new RV1())));
		robots.add(new ArmAddition(new RV1()));
		
		rWithArm = new ArmAddition(new RV1());
		box = new Box("boxy");
	}
	
	
	public void testHasArm() {
		int i = 0;
		//check all robots without arm
		for(; i < 2 ; i++)
			assertEquals(robots.get(i).pickupBox(box), false);
		//check with arm
		assertEquals(robots.get(i).pickupBox(box), true);
	}
	
	public void testPickUpSameBox(){
		//set robots 3 and 4 to same position as box
		box.setPosition(new Position(10,10));
		robots.get(2).setCurrentPosition(10, 10);
		robots.get(3).setCurrentPosition(10, 10);
		assertEquals(robots.get(2).pickupBox(box), true);
		//assertEquals(robots.get(3).pickupBox(box), false);
	}
	
	public void testBoxPosition(){
		assertEquals(rWithArm.pickupBox(box), true);//picks up box
		rWithArm.move(10, 0);
		assertEquals(rWithArm.putDownBox(box), true);//puts it down
		assertEquals(box.getPosition().isSame(new Position(0,10)), true);
		rWithArm.move(10, 0);
		assertEquals(box.getPosition().isSame(new Position(0,10)), true);
	}
}
